<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
 	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>

	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery.js"></script>

	<style type="text/css">

		body{

			background-image:url(img/purty_wood.png);
		}
		span{
			color:red;
		}

	</style>
</head>
<body>
	
	
	
	<div class="container" style="margin-top:100px">
		<form class="well" style="width:220px;margin:0px auto;" action="login.jspx" method="post" id="myform">

		  <legend>Kaishengit-PMS</legend>
		  <c:choose>
			<c:when test="${param.code == '1001'}">
				<div style="color:red">用户名或密码错误！</div>
			</c:when>
			<c:when test="${param.code == '10002' }">
  			<div style="color:red">请先登录</div>
  			</c:when>
				<c:when test="${param.code == '10003' }">
  				<div style="color:red">验证码错误</div>
  			</c:when>
		</c:choose>
	
		<div style="color:red">${msg }</div>
		<c:remove var="msg" scope="session"/>

		  <label>账号</label>

		  <input type="text" class="span3" name="username"><span id="name_error"></span>

		  <label>密码</label>

		  <input type="password" class="span3" name="password"><span id="password_error"></span>

		  <br/>
		  验证码:<input type="text" name="captcha"/>
  		<a href="javascript:;" id="changeValidate"><img id="jcaptcha" alt="" src="jcaptcha.jpg"></a>
  		  <br/>
		  <button type="button" class="btn btn-primary">进入系统</button>
		</form>
	</div>
	
	<script type="text/javascript">
		$(document).ready(function(){
		
			$("#changeValidate").click(function(){
  				$("#jcaptcha").attr("src","jcaptcha.jpg?t="+new Date());
  				
  			});
		
			$(".btn").click(function(){
				var username = $("input[name='username']").val();
				var password = $("input[name='password']").val();
				
				if(username.trim()=="") {
					$("#name_error").html("请输入用户名！");
					return;
				}
				
				if(password=="") {
					$("#password_error").html("请输入密码！");
					return;
				}
				
				$("#myform").submit();
			});
			
			
		});
	</script>
</body>
</html>
